package com.ericom.model;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

@Entity
@Table(name="variation_value")
public class VariationValue extends BaseObject {
	private Long id;
	private String vvalue;
	private VariationType variationType;
	
	@ManyToOne(cascade = { CascadeType.MERGE })  
	@JoinColumn(name = "variationTypeId")
	public VariationType getVariationType() {
		return variationType;
	}
	public void setVariationType(VariationType variationType) {
		this.variationType= variationType;
	}
	@Override
	public String toString() {
		return new ToStringBuilder(this).append("id", id)
				.append("vvalue", vvalue).toString();
	}
	@Override
	public boolean equals(final Object other) {
		if (!(other instanceof VariationValue))
			return false;
		VariationValue castOther = (VariationValue) other;
		return new EqualsBuilder().append(id, castOther.id)
				.append(vvalue, castOther.vvalue).isEquals();
	}
	@Override
	public int hashCode() {
		return new HashCodeBuilder().append(id).append(vvalue).toHashCode();
	}
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getVvalue() {
		return vvalue;
	}
	public void setVvalue(String vvalue) {
		this.vvalue = vvalue;
	}
	
	


}
